<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>

    </style>
</head>

<body>
    <div id="box"></div>
    <button id="btn">停止</button>
</body>
<script>
    // 已知字符串"aabccd"编程实现以下功能。(13K)
    // (1) 去掉重复的字符，使结果显示 abcd 
    var str = "aabccd";
    var re = '';
    for (var k in str) {
        if (re.indexOf(str[k]) == -1) {
            re += str[k];
        }
    }
    console.log(re);


    // (2) 统计每个字符出现的次数，结果显示 a 2、b 1、c 2、d1   字符统计
    var countStr = [];
    for (var char of re) {
        count = 0;
        for (var item of str) {
            if (char == item) { //如果新字符串里的字符在元字符串里出现几次，count就加几次
                count++;
            }
        }
        countStr[countStr.length] = char + count;
    }
    console.log(countStr.join(" 、"));

    // (3) (原始字符串：aaaabbbbbbbccdaaaaa；压缩后：a4b7c2d1a5)  压缩统计


    // 距离十一放假还有多少天xx小时xx分xx秒
    // 1234567(秒)

</script>

</html>